package com.theo.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.theo.entity.TopicInfo;
import com.theo.mapper.TopicInfoMapper;
import com.theo.service.TopicInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 方涛
 * @since 2021-02-02
 */
@Service
public class TopicInfoServiceImpl extends ServiceImpl<TopicInfoMapper, TopicInfo> implements TopicInfoService {

    @Autowired
    private TopicInfoMapper topicInfoMapper;

    @Override
    public int saveTopicInfo(TopicInfo topicInfo) {
        return topicInfoMapper.insert(topicInfo);
    }

    @Override
    public int deleteTopicInfo(Integer id) {
        return topicInfoMapper.deleteTopicInfo(id);
    }

    @Override
    public int updateTopicInfo(TopicInfo topicInfo) {
        return topicInfoMapper.updateById(topicInfo);
    }

    @Override
    public List<TopicInfo> queryAllTopicInfo() {
        return topicInfoMapper.selectList(null);
    }

    @Override
    public List<TopicInfo> queryAllTopicInfoByPage() {
        return topicInfoMapper.queryAllTopicInfoByPage();
    }

    @Override
    public List<TopicInfo> queryAllByTopicTypeId(String id) {
        return topicInfoMapper.queryAllByTopicTypeId(id);
    }

    @Override
    public TopicInfo queryTopicInfoById(Integer id) {
        return topicInfoMapper.selectById(id);
    }
}
